using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class Setting_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(global::Setting);
            args = new Type[]{};
            method = type.GetMethod("LoadSetting", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LoadSetting_0);

            field = type.GetField("Lan", flag);
            app.RegisterCLRFieldGetter(field, get_Lan_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_Lan_0, null);
            field = type.GetField("Chinese", flag);
            app.RegisterCLRFieldGetter(field, get_Chinese_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_Chinese_1, null);
            field = type.GetField("English", flag);
            app.RegisterCLRFieldGetter(field, get_English_2);
            app.RegisterCLRFieldBinding(field, CopyToStack_English_2, null);
            field = type.GetField("Language", flag);
            app.RegisterCLRFieldGetter(field, get_Language_3);
            app.RegisterCLRFieldSetter(field, set_Language_3);
            app.RegisterCLRFieldBinding(field, CopyToStack_Language_3, AssignFromStack_Language_3);


            app.RegisterCLRCreateDefaultInstance(type, () => new global::Setting());
            app.RegisterCLRCreateArrayInstance(type, s => new global::Setting[s]);

            args = new Type[]{};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);

        }


        static StackObject* LoadSetting_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);


            global::Setting.LoadSetting();

            return __ret;
        }


        static object get_Lan_0(ref object o)
        {
            return global::Setting.Lan;
        }

        static StackObject* CopyToStack_Lan_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = global::Setting.Lan;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static object get_Chinese_1(ref object o)
        {
            return global::Setting.Chinese;
        }

        static StackObject* CopyToStack_Chinese_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = global::Setting.Chinese;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static object get_English_2(ref object o)
        {
            return global::Setting.English;
        }

        static StackObject* CopyToStack_English_2(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = global::Setting.English;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static object get_Language_3(ref object o)
        {
            return global::Setting.Language;
        }

        static StackObject* CopyToStack_Language_3(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = global::Setting.Language;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_Language_3(ref object o, object v)
        {
            global::Setting.Language = (System.String)v;
        }

        static StackObject* AssignFromStack_Language_3(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.String @Language = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            global::Setting.Language = @Language;
            return ptr_of_this_method;
        }



        static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);

            var result_of_this_method = new global::Setting();

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }


    }
}
